<template>
    <div class="back_contain_n">
        <div class="Search_Top_Input">
            <div class="addNew">
                <div @click="zhanbiDialog = true" v-if="hasRole('user:system:add')">
                    <img src="@/assets/back_manage_img/zhanbi.png" alt="">
                </div>
                <div @click="nianduDialog = true" v-if="hasRole('user:system:add')">
                    <img src="@/assets/back_manage_img/niandu.png" alt="">
                </div>
            </div>
        </div>
        <!-- table -->
        <sys-table
            :tableData="tableData" :isOperate="false"
            :tableLoading="tableLoading" 
            :tableHeader="tableHeader" 
        ></sys-table>
        <div class="zll-dialog">
            <popout title="废料 · 占比分析" :visible.sync="zhanbiDialog" v-if="zhanbiDialog" class="bigSize">
                <zhan-bi ref="add" slot="content"></zhan-bi>
                <template slot="bottom">
                    <p class="zll-botton Info" @click="zhanbiDialog = false">关 闭</p>
                </template>
            </popout>
        </div> 
        <div class="zll-dialog">
            <popout title="废料 · 年度趋势分析" :visible.sync="nianduDialog" v-if="nianduDialog" class="largeSize">
                <nian-du ref="add" slot="content"></nian-du>
                <template slot="bottom">
                    <p class="zll-botton Info" @click="nianduDialog = false">关 闭</p>
                </template>
            </popout>
        </div> 
    </div>
</template>

<script>
import ZhanBi from './zhanbi.vue'
import NianDu from './niandu.vue'
export default {
    data(){
        return {
            zhanbiDialog: false,
            nianduDialog: false,
            editData: {},
            type: '',		
            tableLoading:true, //table刷新
            tableData: [],
            tableHeader:[],
        }
    },
    methods: {
		getList() {
			let self = this;
			self.tableLoading = false;
			self.$http({
				url: "/jinl/abandonHandle/getAbandonVoList",
				method: "post",
			}).then(resp => {
				if (resp.success) {
					self.tableHeader =  [
						{"columnValue": "abandonTypeCn", "columnName": "废料类型" },
						{"columnValue": "unit", "columnName": "单位" },
						{"columnValue": "preYearWeight", "columnName": "上年期末" },
						{"columnValue": "todayYearInWeight", "columnName": "本年入库"},
						{"columnValue": "todayYearOutWeight", "columnName": "本年出库"},
						{"columnValue": "todayMothInWeight", "columnName": "本月入库"},
						{"columnValue": "todayMothOutWeight", "columnName": "本月出库"},
						{"columnValue": "todayInWeight", "columnName": "今日入库"},
						{"columnValue": "todayOutWeight", "columnName": "今日出库"},
						{"columnValue": "currentWeight", "columnName": "当前库存"},
					];
					self.tableData = resp.result;
				}
			});
		},

    },
    mounted(){
        let self = this;
        self.getList();
    },
    components: {ZhanBi,NianDu},
}
</script>

<style lang="scss" scoped>
@import "@/style/SearchTop.scss";
.addNew {
    display: flex;
    div img {
        width: 90px;margin-right: 20px;
    }
}
</style>